﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Dcms.BLL;
using Dcms.Model;
using System.Collections.Generic;

public partial class Manage_Modle_ModelField_AddModelField : System.Web.UI.Page
{
    /// <summary>
    /// 页面加载
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
    }

    /// <summary>
    /// 新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Dcms_ModelFieldBLL mBll = new Dcms_ModelFieldBLL();
        Dcms_ModelFieldModel mModel = new Dcms_ModelFieldModel();

        mModel.mf_FieldName = txtMF_FieldName.Text.Trim();
        mModel.mf_FieldLabel = txtMF_FieldLabel.Text.Trim();
        mModel.mf_DisplayFlag = 1;
        mModel.mf_Model = ddlMF_Model.SelectedValue;
        mModel.mf_ValidateType = 0;
        mModel.mf_ValidateField = "";
        mModel.mf_RegexErrorMsg = "";
        mModel.mf_MustField = Convert.ToInt32(rblMF_MustField.SelectedValue);
        mModel.mf_Order = 9999;
        mModel.mf_FieldInfo = txtMF_FieldInfo.Text.Replace("{txtID}", "txt" + txtMF_FieldName.Text.Trim()).Replace("{rfvID}", "rfv_" + txtMF_FieldName.Text.Trim()).Replace("{revID}", "rev_" + txtMF_FieldName.Text.Trim());
        mModel.mf_FieldHelpInfo = "";
        mModel.mf_FieldDefaultValue = "";
        mModel.mf_RequiredField = 0;
        mModel.mf_ModelKeyId = 0;

        mBll.AddModel(mModel);

        txtMF_FieldName.Text = "新增成功!";
    }
}